package com.boonya.lab.job;

import com.boonya.lab.rpc.client.WebSiteClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Pengjunlin
 * @date 2024/12/28
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class WebsiteSchedule {

    private final WebSiteClient webSiteClient;

    @Scheduled(fixedDelay = 30000)
    public void getChinaWebsite() {
        WebSiteClient.WebsiteResponse response = webSiteClient.getHttpWebsite(new WebSiteClient.AreaReq("china"));
        log.info("获取到信息：{}", response);
    }

    @Scheduled(fixedDelay = 30000)
    public void getUsaWebsite() {
        WebSiteClient.WebsiteResponse response = webSiteClient.getHttpWebsite(new WebSiteClient.AreaReq("usa"));
        log.info("获取到信息：{}", response);
    }
}
